package performance;

import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.junit.Ignore;

/**
 *
 * @author lacungus
 */
@Ignore
public class PerformanceMain {

    private PrintWriter writer;
    private File file;

    private PerformanceMain() {
    }

    private PrintWriter getWriter() throws Exception {
        file = new File("./reports/" + getFileName());
        writer = new PrintWriter(new FileWriter(file));
        return writer;
    }

    private String getFileName() {
        Date now = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd_HH:mm:ss");
        return format.format(now);
    }

    private void destroy() throws Exception {
        writer.close();
    }

    private void run() throws Exception {
        writer = getWriter();

        PerformanceTest test;

        test = new WarmingUpTest();
        test.run(writer);

        test = new AdvancedAttackDiagramBuilderTest();
        test.run(writer);

        test = new SimpleAttackDiagramBuilderTest();
        test.run(writer);

        test = new BacktrackStrategyCacheOffTest();
        test.run(writer);

        test = new BacktrackStrategyCacheOnTest();
        test.run(writer);

        destroy();
    }

    public static void main(String[] args) throws Exception {
        PerformanceMain inst = new PerformanceMain();
        inst.run();
    }
}
